/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ticketManager.ejb;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;
import ticketManager.model.*;


/**
 *
 * @author luchenyuxx
 */
@Stateless
public class ManagerHelper {
    @PersistenceContext
    EntityManager em;
    public String assignProblem(Long mId,Long uId,Long pId){
        ManagerUser m=em.find(ManagerUser.class, mId);
        ManagerUser u=em.find(ManagerUser.class, uId);
        Problem p=em.find(Problem.class, pId);
//        m.assignProblem(p, u);
        p.setState(ProblemStates.InWork);
        p.setAssigner(m);
        p.setSolver(u);
        return "success";
    }
}
